//
//  HBDataSource.h
//  HBLibary
//
//  Created by Rambo on 2018/6/8.
//

#import <Foundation/Foundation.h>

typedef void(^HBDataSourceHandle)(id cell, id model, NSIndexPath *indexPath);

@interface HBDataSource : NSObject <UITableViewDataSource, UICollectionViewDataSource>

/**
 UITableViewDataSource 或者 UICollectionViewDataSource 数据源处理，初始化时请先注册cell
 只处理组数、行数、cell三个数据源
 
 @param identifier cell的标识符
 @param dataSource 回调
 @return HBDataSourceHandle对象
 */
- (instancetype)initWithIdentifier:(NSString*)identifier tableViewDataSource:(HBDataSourceHandle)dataSource;

- (void)addModels:(NSArray*)models;

- (void)removeAllModel;

- (id)getModelWithIndexPath:(NSIndexPath*)indexPath;

- (NSArray*)getAllModels;

- (void)removeModel:(id)model;

- (void)removeModelAtIndexPath:(NSIndexPath*)indexPath;

- (instancetype)init UNAVAILABLE_ATTRIBUTE;
+ (instancetype)new UNAVAILABLE_ATTRIBUTE;


@end
